<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/3/13
 * Time: 20:06
 */

namespace service\k3\util;


class InventoryReader extends AbstractReader
{
    function setTable()
    {
        $this->table = 'v_Xinm_WWStock';
    }

    function setFiled()
    {
        $this->field = 'FSupplyCode as supplier_id,FitemCode as sub_materiel_id,sum(FQty) as count';
    }

    function setSql()
    {
        $suffix = sprintf('select %s from %s ', $this->field, $this->table);
        $this->sql = $suffix . " where FSupplyCode = '%s' and fqty <> 0".' group by FSupplyCode,FitemCode';
    }

    function setBaseSql(){
        $this->baseSql  = sprintf('select %s from %s where fqty <> 0', $this->field, $this->table).' group by FSupplyCode,FitemCode';
    }
}